﻿using System;
using System.ComponentModel;
using System.IO;
using System.Runtime.Serialization;

namespace HalconDotNet
{
	/// <summary>Represents an instance of a model for the component-based matching.</summary>
	// Token: 0x02000028 RID: 40
	[Serializable]
	public class HComponentModel : HHandle, ISerializable, ICloneable
	{
		// Token: 0x0600036C RID: 876 RVA: 0x0000883B File Offset: 0x00006A3B
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HComponentModel() : base(HHandleBase.UNDEF)
		{
		}

		// Token: 0x0600036D RID: 877 RVA: 0x000141B8 File Offset: 0x000123B8
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HComponentModel(IntPtr handle) : base(handle)
		{
			this.AssertSemType();
		}

		// Token: 0x0600036E RID: 878 RVA: 0x000141C7 File Offset: 0x000123C7
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HComponentModel(HHandle handle) : base(handle)
		{
			this.AssertSemType();
		}

		// Token: 0x0600036F RID: 879 RVA: 0x000141D6 File Offset: 0x000123D6
		private void AssertSemType()
		{
			base.AssertSemType("component_model");
		}

		// Token: 0x06000370 RID: 880 RVA: 0x000141E3 File Offset: 0x000123E3
		internal static int LoadNew(IntPtr proc, int parIndex, int err, out HComponentModel obj)
		{
			obj = new HComponentModel(HHandleBase.UNDEF);
			return obj.Load(proc, parIndex, err);
		}

		// Token: 0x06000371 RID: 881 RVA: 0x000141FC File Offset: 0x000123FC
		internal static int LoadNew(IntPtr proc, int parIndex, int err, out HComponentModel[] obj)
		{
			HTuple htuple;
			err = HTuple.LoadNew(proc, parIndex, err, out htuple);
			obj = new HComponentModel[htuple.Length];
			for (int i = 0; i < htuple.Length; i++)
			{
				obj[i] = new HComponentModel(HalconAPI.IsLegacyHandleMode() ? htuple[i].IP : htuple[i].H);
			}
			htuple.Dispose();
			return err;
		}

		/// <summary>
		///   Read a component model from a file.
		///   Modified instance represents: Handle of the component model.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x06000372 RID: 882 RVA: 0x0001426C File Offset: 0x0001246C
		public HComponentModel(string fileName)
		{
			IntPtr proc = HalconAPI.PreCall(1002);
			HalconAPI.StoreS(proc, 0, fileName);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Prepare a component model for matching based on explicitly specified components and relations.
		///   Modified instance represents: Handle of the component model.
		/// </summary>
		/// <param name="modelImage">Input image from which the shape models of the model components should be created.</param>
		/// <param name="componentRegions">Input regions from which the shape models of the model components should be created.</param>
		/// <param name="variationRow">Variation of the model components in row direction.</param>
		/// <param name="variationColumn">Variation of the model components in column direction.</param>
		/// <param name="variationAngle">Angle variation of the model components.</param>
		/// <param name="angleStart">Smallest rotation of the component model. Default: -0.39</param>
		/// <param name="angleExtent">Extent of the rotation of the component model. Default: 0.79</param>
		/// <param name="contrastLowComp">Lower hysteresis threshold for the contrast of the components in the model image. Default: "auto"</param>
		/// <param name="contrastHighComp">Upper hysteresis threshold for the contrast of the components in the model image. Default: "auto"</param>
		/// <param name="minSizeComp">Minimum size of the contour regions in the model. Default: "auto"</param>
		/// <param name="minContrastComp">Minimum contrast of the components in the search images. Default: "auto"</param>
		/// <param name="minScoreComp">Minimum score of the instances of the components to be found. Default: 0.5</param>
		/// <param name="numLevelsComp">Maximum number of pyramid levels for the components. Default: "auto"</param>
		/// <param name="angleStepComp">Step length of the angles (resolution) for the components. Default: "auto"</param>
		/// <param name="optimizationComp">Kind of optimization for the components. Default: "auto"</param>
		/// <param name="metricComp">Match metric used for the components. Default: "use_polarity"</param>
		/// <param name="pregenerationComp">Complete pregeneration of the shape models for the components if equal to 'true'. Default: "false"</param>
		/// <param name="rootRanking">Ranking of the model components expressing the suitability to act as the root component.</param>
		// Token: 0x06000373 RID: 883 RVA: 0x000142B8 File Offset: 0x000124B8
		public HComponentModel(HImage modelImage, HRegion componentRegions, HTuple variationRow, HTuple variationColumn, HTuple variationAngle, double angleStart, double angleExtent, HTuple contrastLowComp, HTuple contrastHighComp, HTuple minSizeComp, HTuple minContrastComp, HTuple minScoreComp, HTuple numLevelsComp, HTuple angleStepComp, string optimizationComp, HTuple metricComp, HTuple pregenerationComp, out HTuple rootRanking)
		{
			IntPtr proc = HalconAPI.PreCall(1004);
			HalconAPI.Store(proc, 1, modelImage);
			HalconAPI.Store(proc, 2, componentRegions);
			HalconAPI.Store(proc, 0, variationRow);
			HalconAPI.Store(proc, 1, variationColumn);
			HalconAPI.Store(proc, 2, variationAngle);
			HalconAPI.StoreD(proc, 3, angleStart);
			HalconAPI.StoreD(proc, 4, angleExtent);
			HalconAPI.Store(proc, 5, contrastLowComp);
			HalconAPI.Store(proc, 6, contrastHighComp);
			HalconAPI.Store(proc, 7, minSizeComp);
			HalconAPI.Store(proc, 8, minContrastComp);
			HalconAPI.Store(proc, 9, minScoreComp);
			HalconAPI.Store(proc, 10, numLevelsComp);
			HalconAPI.Store(proc, 11, angleStepComp);
			HalconAPI.StoreS(proc, 12, optimizationComp);
			HalconAPI.Store(proc, 13, metricComp);
			HalconAPI.Store(proc, 14, pregenerationComp);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(variationRow);
			HalconAPI.UnpinTuple(variationColumn);
			HalconAPI.UnpinTuple(variationAngle);
			HalconAPI.UnpinTuple(contrastLowComp);
			HalconAPI.UnpinTuple(contrastHighComp);
			HalconAPI.UnpinTuple(minSizeComp);
			HalconAPI.UnpinTuple(minContrastComp);
			HalconAPI.UnpinTuple(minScoreComp);
			HalconAPI.UnpinTuple(numLevelsComp);
			HalconAPI.UnpinTuple(angleStepComp);
			HalconAPI.UnpinTuple(metricComp);
			HalconAPI.UnpinTuple(pregenerationComp);
			num = base.Load(proc, 0, num);
			num = HTuple.LoadNew(proc, 1, HTupleType.INTEGER, num, out rootRanking);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(modelImage);
			GC.KeepAlive(componentRegions);
		}

		/// <summary>
		///   Prepare a component model for matching based on explicitly specified components and relations.
		///   Modified instance represents: Handle of the component model.
		/// </summary>
		/// <param name="modelImage">Input image from which the shape models of the model components should be created.</param>
		/// <param name="componentRegions">Input regions from which the shape models of the model components should be created.</param>
		/// <param name="variationRow">Variation of the model components in row direction.</param>
		/// <param name="variationColumn">Variation of the model components in column direction.</param>
		/// <param name="variationAngle">Angle variation of the model components.</param>
		/// <param name="angleStart">Smallest rotation of the component model. Default: -0.39</param>
		/// <param name="angleExtent">Extent of the rotation of the component model. Default: 0.79</param>
		/// <param name="contrastLowComp">Lower hysteresis threshold for the contrast of the components in the model image. Default: "auto"</param>
		/// <param name="contrastHighComp">Upper hysteresis threshold for the contrast of the components in the model image. Default: "auto"</param>
		/// <param name="minSizeComp">Minimum size of the contour regions in the model. Default: "auto"</param>
		/// <param name="minContrastComp">Minimum contrast of the components in the search images. Default: "auto"</param>
		/// <param name="minScoreComp">Minimum score of the instances of the components to be found. Default: 0.5</param>
		/// <param name="numLevelsComp">Maximum number of pyramid levels for the components. Default: "auto"</param>
		/// <param name="angleStepComp">Step length of the angles (resolution) for the components. Default: "auto"</param>
		/// <param name="optimizationComp">Kind of optimization for the components. Default: "auto"</param>
		/// <param name="metricComp">Match metric used for the components. Default: "use_polarity"</param>
		/// <param name="pregenerationComp">Complete pregeneration of the shape models for the components if equal to 'true'. Default: "false"</param>
		/// <param name="rootRanking">Ranking of the model components expressing the suitability to act as the root component.</param>
		// Token: 0x06000374 RID: 884 RVA: 0x0001440C File Offset: 0x0001260C
		public HComponentModel(HImage modelImage, HRegion componentRegions, int variationRow, int variationColumn, double variationAngle, double angleStart, double angleExtent, int contrastLowComp, int contrastHighComp, int minSizeComp, int minContrastComp, double minScoreComp, int numLevelsComp, double angleStepComp, string optimizationComp, string metricComp, string pregenerationComp, out int rootRanking)
		{
			IntPtr proc = HalconAPI.PreCall(1004);
			HalconAPI.Store(proc, 1, modelImage);
			HalconAPI.Store(proc, 2, componentRegions);
			HalconAPI.StoreI(proc, 0, variationRow);
			HalconAPI.StoreI(proc, 1, variationColumn);
			HalconAPI.StoreD(proc, 2, variationAngle);
			HalconAPI.StoreD(proc, 3, angleStart);
			HalconAPI.StoreD(proc, 4, angleExtent);
			HalconAPI.StoreI(proc, 5, contrastLowComp);
			HalconAPI.StoreI(proc, 6, contrastHighComp);
			HalconAPI.StoreI(proc, 7, minSizeComp);
			HalconAPI.StoreI(proc, 8, minContrastComp);
			HalconAPI.StoreD(proc, 9, minScoreComp);
			HalconAPI.StoreI(proc, 10, numLevelsComp);
			HalconAPI.StoreD(proc, 11, angleStepComp);
			HalconAPI.StoreS(proc, 12, optimizationComp);
			HalconAPI.StoreS(proc, 13, metricComp);
			HalconAPI.StoreS(proc, 14, pregenerationComp);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			num = HalconAPI.LoadI(proc, 1, num, out rootRanking);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(modelImage);
			GC.KeepAlive(componentRegions);
		}

		/// <summary>
		///   Prepare a component model for matching based on trained components.
		///   Modified instance represents: Handle of the component model.
		/// </summary>
		/// <param name="componentTrainingID">Handle of the training result.</param>
		/// <param name="angleStart">Smallest rotation of the component model. Default: -0.39</param>
		/// <param name="angleExtent">Extent of the rotation of the component model. Default: 0.79</param>
		/// <param name="minContrastComp">Minimum contrast of the components in the search images. Default: "auto"</param>
		/// <param name="minScoreComp">Minimum score of the instances of the components to be found. Default: 0.5</param>
		/// <param name="numLevelsComp">Maximum number of pyramid levels for the components. Default: "auto"</param>
		/// <param name="angleStepComp">Step length of the angles (resolution) for the components. Default: "auto"</param>
		/// <param name="optimizationComp">Kind of optimization for the components. Default: "auto"</param>
		/// <param name="metricComp">Match metric used for the components. Default: "use_polarity"</param>
		/// <param name="pregenerationComp">Complete pregeneration of the shape models for the components if equal to 'true'. Default: "false"</param>
		/// <param name="rootRanking">Ranking of the model components expressing the suitability to act as the root component.</param>
		// Token: 0x06000375 RID: 885 RVA: 0x0001450C File Offset: 0x0001270C
		public HComponentModel(HComponentTraining componentTrainingID, double angleStart, double angleExtent, HTuple minContrastComp, HTuple minScoreComp, HTuple numLevelsComp, HTuple angleStepComp, string optimizationComp, HTuple metricComp, HTuple pregenerationComp, out HTuple rootRanking)
		{
			IntPtr proc = HalconAPI.PreCall(1005);
			HalconAPI.Store(proc, 0, componentTrainingID);
			HalconAPI.StoreD(proc, 1, angleStart);
			HalconAPI.StoreD(proc, 2, angleExtent);
			HalconAPI.Store(proc, 3, minContrastComp);
			HalconAPI.Store(proc, 4, minScoreComp);
			HalconAPI.Store(proc, 5, numLevelsComp);
			HalconAPI.Store(proc, 6, angleStepComp);
			HalconAPI.StoreS(proc, 7, optimizationComp);
			HalconAPI.Store(proc, 8, metricComp);
			HalconAPI.Store(proc, 9, pregenerationComp);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(minContrastComp);
			HalconAPI.UnpinTuple(minScoreComp);
			HalconAPI.UnpinTuple(numLevelsComp);
			HalconAPI.UnpinTuple(angleStepComp);
			HalconAPI.UnpinTuple(metricComp);
			HalconAPI.UnpinTuple(pregenerationComp);
			num = base.Load(proc, 0, num);
			num = HTuple.LoadNew(proc, 1, HTupleType.INTEGER, num, out rootRanking);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(componentTrainingID);
		}

		/// <summary>
		///   Prepare a component model for matching based on trained components.
		///   Modified instance represents: Handle of the component model.
		/// </summary>
		/// <param name="componentTrainingID">Handle of the training result.</param>
		/// <param name="angleStart">Smallest rotation of the component model. Default: -0.39</param>
		/// <param name="angleExtent">Extent of the rotation of the component model. Default: 0.79</param>
		/// <param name="minContrastComp">Minimum contrast of the components in the search images. Default: "auto"</param>
		/// <param name="minScoreComp">Minimum score of the instances of the components to be found. Default: 0.5</param>
		/// <param name="numLevelsComp">Maximum number of pyramid levels for the components. Default: "auto"</param>
		/// <param name="angleStepComp">Step length of the angles (resolution) for the components. Default: "auto"</param>
		/// <param name="optimizationComp">Kind of optimization for the components. Default: "auto"</param>
		/// <param name="metricComp">Match metric used for the components. Default: "use_polarity"</param>
		/// <param name="pregenerationComp">Complete pregeneration of the shape models for the components if equal to 'true'. Default: "false"</param>
		/// <param name="rootRanking">Ranking of the model components expressing the suitability to act as the root component.</param>
		// Token: 0x06000376 RID: 886 RVA: 0x000145EC File Offset: 0x000127EC
		public HComponentModel(HComponentTraining componentTrainingID, double angleStart, double angleExtent, int minContrastComp, double minScoreComp, int numLevelsComp, double angleStepComp, string optimizationComp, string metricComp, string pregenerationComp, out int rootRanking)
		{
			IntPtr proc = HalconAPI.PreCall(1005);
			HalconAPI.Store(proc, 0, componentTrainingID);
			HalconAPI.StoreD(proc, 1, angleStart);
			HalconAPI.StoreD(proc, 2, angleExtent);
			HalconAPI.StoreI(proc, 3, minContrastComp);
			HalconAPI.StoreD(proc, 4, minScoreComp);
			HalconAPI.StoreI(proc, 5, numLevelsComp);
			HalconAPI.StoreD(proc, 6, angleStepComp);
			HalconAPI.StoreS(proc, 7, optimizationComp);
			HalconAPI.StoreS(proc, 8, metricComp);
			HalconAPI.StoreS(proc, 9, pregenerationComp);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			num = HalconAPI.LoadI(proc, 1, num, out rootRanking);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(componentTrainingID);
		}

		// Token: 0x06000377 RID: 887 RVA: 0x000146A4 File Offset: 0x000128A4
		void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
		{
			HSerializedItem hserializedItem = this.SerializeComponentModel();
			byte[] value = hserializedItem;
			hserializedItem.Dispose();
			info.AddValue("data", value, typeof(byte[]));
		}

		// Token: 0x06000378 RID: 888 RVA: 0x000146DC File Offset: 0x000128DC
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HComponentModel(SerializationInfo info, StreamingContext context)
		{
			HSerializedItem hserializedItem = new HSerializedItem((byte[])info.GetValue("data", typeof(byte[])));
			this.DeserializeComponentModel(hserializedItem);
			hserializedItem.Dispose();
		}

		/// <summary>Serialize object to binary stream in HALCON format</summary>
		// Token: 0x06000379 RID: 889 RVA: 0x0001471C File Offset: 0x0001291C
		public new void Serialize(Stream stream)
		{
			HSerializedItem hserializedItem = this.SerializeComponentModel();
			hserializedItem.Serialize(stream);
			hserializedItem.Dispose();
		}

		/// <summary>Deserialize object from binary stream in HALCON format</summary>
		// Token: 0x0600037A RID: 890 RVA: 0x00014730 File Offset: 0x00012930
		public new static HComponentModel Deserialize(Stream stream)
		{
			HComponentModel hcomponentModel = new HComponentModel();
			HSerializedItem hserializedItem = HSerializedItem.Deserialize(stream);
			hcomponentModel.DeserializeComponentModel(hserializedItem);
			hserializedItem.Dispose();
			return hcomponentModel;
		}

		// Token: 0x0600037B RID: 891 RVA: 0x00014756 File Offset: 0x00012956
		object ICloneable.Clone()
		{
			return this.Clone();
		}

		// Token: 0x0600037C RID: 892 RVA: 0x00014760 File Offset: 0x00012960
		public new HComponentModel Clone()
		{
			HSerializedItem hserializedItem = this.SerializeComponentModel();
			HComponentModel hcomponentModel = new HComponentModel();
			hcomponentModel.DeserializeComponentModel(hserializedItem);
			hserializedItem.Dispose();
			return hcomponentModel;
		}

		/// <summary>
		///   Return the components of a found instance of a component model.
		///   Instance represents: Handle of the component model.
		/// </summary>
		/// <param name="modelStart">Start index of each found instance of the component model in the tuples describing the component matches.</param>
		/// <param name="modelEnd">End index of each found instance of the component model to the tuples describing the component matches.</param>
		/// <param name="rowComp">Row coordinate of the found component matches.</param>
		/// <param name="columnComp">Column coordinate of the found component matches.</param>
		/// <param name="angleComp">Rotation angle of the found component matches.</param>
		/// <param name="scoreComp">Score of the found component matches.</param>
		/// <param name="modelComp">Index of the found components.</param>
		/// <param name="modelMatch">Index of the found instance of the component model to be returned.</param>
		/// <param name="markOrientation">Mark the orientation of the components. Default: "false"</param>
		/// <param name="rowCompInst">Row coordinate of all components of the selected model instance.</param>
		/// <param name="columnCompInst">Column coordinate of all components of the selected model instance.</param>
		/// <param name="angleCompInst">Rotation angle of all components of the selected model instance.</param>
		/// <param name="scoreCompInst">Score of all components of the selected model instance.</param>
		/// <returns>Found components of the selected component model instance.</returns>
		// Token: 0x0600037D RID: 893 RVA: 0x00014788 File Offset: 0x00012988
		public HRegion GetFoundComponentModel(HTuple modelStart, HTuple modelEnd, HTuple rowComp, HTuple columnComp, HTuple angleComp, HTuple scoreComp, HTuple modelComp, int modelMatch, string markOrientation, out HTuple rowCompInst, out HTuple columnCompInst, out HTuple angleCompInst, out HTuple scoreCompInst)
		{
			IntPtr proc = HalconAPI.PreCall(994);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, modelStart);
			HalconAPI.Store(proc, 2, modelEnd);
			HalconAPI.Store(proc, 3, rowComp);
			HalconAPI.Store(proc, 4, columnComp);
			HalconAPI.Store(proc, 5, angleComp);
			HalconAPI.Store(proc, 6, scoreComp);
			HalconAPI.Store(proc, 7, modelComp);
			HalconAPI.StoreI(proc, 8, modelMatch);
			HalconAPI.StoreS(proc, 9, markOrientation);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(modelStart);
			HalconAPI.UnpinTuple(modelEnd);
			HalconAPI.UnpinTuple(rowComp);
			HalconAPI.UnpinTuple(columnComp);
			HalconAPI.UnpinTuple(angleComp);
			HalconAPI.UnpinTuple(scoreComp);
			HalconAPI.UnpinTuple(modelComp);
			HRegion result;
			num = HRegion.LoadNew(proc, 1, num, out result);
			num = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, num, out rowCompInst);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out columnCompInst);
			num = HTuple.LoadNew(proc, 2, HTupleType.DOUBLE, num, out angleCompInst);
			num = HTuple.LoadNew(proc, 3, HTupleType.DOUBLE, num, out scoreCompInst);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Return the components of a found instance of a component model.
		///   Instance represents: Handle of the component model.
		/// </summary>
		/// <param name="modelStart">Start index of each found instance of the component model in the tuples describing the component matches.</param>
		/// <param name="modelEnd">End index of each found instance of the component model to the tuples describing the component matches.</param>
		/// <param name="rowComp">Row coordinate of the found component matches.</param>
		/// <param name="columnComp">Column coordinate of the found component matches.</param>
		/// <param name="angleComp">Rotation angle of the found component matches.</param>
		/// <param name="scoreComp">Score of the found component matches.</param>
		/// <param name="modelComp">Index of the found components.</param>
		/// <param name="modelMatch">Index of the found instance of the component model to be returned.</param>
		/// <param name="markOrientation">Mark the orientation of the components. Default: "false"</param>
		/// <param name="rowCompInst">Row coordinate of all components of the selected model instance.</param>
		/// <param name="columnCompInst">Column coordinate of all components of the selected model instance.</param>
		/// <param name="angleCompInst">Rotation angle of all components of the selected model instance.</param>
		/// <param name="scoreCompInst">Score of all components of the selected model instance.</param>
		/// <returns>Found components of the selected component model instance.</returns>
		// Token: 0x0600037E RID: 894 RVA: 0x000148A0 File Offset: 0x00012AA0
		public HRegion GetFoundComponentModel(int modelStart, int modelEnd, double rowComp, double columnComp, double angleComp, double scoreComp, int modelComp, int modelMatch, string markOrientation, out double rowCompInst, out double columnCompInst, out double angleCompInst, out double scoreCompInst)
		{
			IntPtr proc = HalconAPI.PreCall(994);
			base.Store(proc, 0);
			HalconAPI.StoreI(proc, 1, modelStart);
			HalconAPI.StoreI(proc, 2, modelEnd);
			HalconAPI.StoreD(proc, 3, rowComp);
			HalconAPI.StoreD(proc, 4, columnComp);
			HalconAPI.StoreD(proc, 5, angleComp);
			HalconAPI.StoreD(proc, 6, scoreComp);
			HalconAPI.StoreI(proc, 7, modelComp);
			HalconAPI.StoreI(proc, 8, modelMatch);
			HalconAPI.StoreS(proc, 9, markOrientation);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			int num = HalconAPI.CallProcedure(proc);
			HRegion result;
			num = HRegion.LoadNew(proc, 1, num, out result);
			num = HalconAPI.LoadD(proc, 0, num, out rowCompInst);
			num = HalconAPI.LoadD(proc, 1, num, out columnCompInst);
			num = HalconAPI.LoadD(proc, 2, num, out angleCompInst);
			num = HalconAPI.LoadD(proc, 3, num, out scoreCompInst);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Find the best matches of a component model in an image.
		///   Instance represents: Handle of the component model.
		/// </summary>
		/// <param name="image">Input image in which the component model should be found.</param>
		/// <param name="rootComponent">Index of the root component.</param>
		/// <param name="angleStartRoot">Smallest rotation of the root component Default: -0.39</param>
		/// <param name="angleExtentRoot">Extent of the rotation of the root component. Default: 0.79</param>
		/// <param name="minScore">Minimum score of the instances of the component model to be found. Default: 0.5</param>
		/// <param name="numMatches">Number of instances of the component model to be found (or 0 for all matches). Default: 1</param>
		/// <param name="maxOverlap">Maximum overlap of the instances of the component models to be found. Default: 0.5</param>
		/// <param name="ifRootNotFound">Behavior if the root component is missing. Default: "stop_search"</param>
		/// <param name="ifComponentNotFound">Behavior if a component is missing. Default: "prune_branch"</param>
		/// <param name="posePrediction">Pose prediction of components that are not found. Default: "none"</param>
		/// <param name="minScoreComp">Minimum score of the instances of the components to be found. Default: 0.5</param>
		/// <param name="subPixelComp">Subpixel accuracy of the component poses if not equal to 'none'. Default: "least_squares"</param>
		/// <param name="numLevelsComp">Number of pyramid levels for the components used in the matching (and lowest pyramid level to use if $|NumLevelsComp| = 2n$). Default: 0</param>
		/// <param name="greedinessComp">"Greediness" of the search heuristic for the components (0: safe but slow; 1: fast but matches may be missed). Default: 0.9</param>
		/// <param name="modelEnd">End index of each found instance of the component model in the tuples describing the component matches.</param>
		/// <param name="score">Score of the found instances of the component model.</param>
		/// <param name="rowComp">Row coordinate of the found component matches.</param>
		/// <param name="columnComp">Column coordinate of the found component matches.</param>
		/// <param name="angleComp">Rotation angle of the found component matches.</param>
		/// <param name="scoreComp">Score of the found component matches.</param>
		/// <param name="modelComp">Index of the found components.</param>
		/// <returns>Start index of each found instance of the component model in the tuples describing the component matches.</returns>
		// Token: 0x0600037F RID: 895 RVA: 0x00014984 File Offset: 0x00012B84
		public HTuple FindComponentModel(HImage image, HTuple rootComponent, HTuple angleStartRoot, HTuple angleExtentRoot, double minScore, int numMatches, double maxOverlap, string ifRootNotFound, string ifComponentNotFound, string posePrediction, HTuple minScoreComp, HTuple subPixelComp, HTuple numLevelsComp, HTuple greedinessComp, out HTuple modelEnd, out HTuple score, out HTuple rowComp, out HTuple columnComp, out HTuple angleComp, out HTuple scoreComp, out HTuple modelComp)
		{
			IntPtr proc = HalconAPI.PreCall(995);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, image);
			HalconAPI.Store(proc, 1, rootComponent);
			HalconAPI.Store(proc, 2, angleStartRoot);
			HalconAPI.Store(proc, 3, angleExtentRoot);
			HalconAPI.StoreD(proc, 4, minScore);
			HalconAPI.StoreI(proc, 5, numMatches);
			HalconAPI.StoreD(proc, 6, maxOverlap);
			HalconAPI.StoreS(proc, 7, ifRootNotFound);
			HalconAPI.StoreS(proc, 8, ifComponentNotFound);
			HalconAPI.StoreS(proc, 9, posePrediction);
			HalconAPI.Store(proc, 10, minScoreComp);
			HalconAPI.Store(proc, 11, subPixelComp);
			HalconAPI.Store(proc, 12, numLevelsComp);
			HalconAPI.Store(proc, 13, greedinessComp);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			HalconAPI.InitOCT(proc, 4);
			HalconAPI.InitOCT(proc, 5);
			HalconAPI.InitOCT(proc, 6);
			HalconAPI.InitOCT(proc, 7);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(rootComponent);
			HalconAPI.UnpinTuple(angleStartRoot);
			HalconAPI.UnpinTuple(angleExtentRoot);
			HalconAPI.UnpinTuple(minScoreComp);
			HalconAPI.UnpinTuple(subPixelComp);
			HalconAPI.UnpinTuple(numLevelsComp);
			HalconAPI.UnpinTuple(greedinessComp);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, num, out result);
			num = HTuple.LoadNew(proc, 1, HTupleType.INTEGER, num, out modelEnd);
			num = HTuple.LoadNew(proc, 2, HTupleType.DOUBLE, num, out score);
			num = HTuple.LoadNew(proc, 3, HTupleType.DOUBLE, num, out rowComp);
			num = HTuple.LoadNew(proc, 4, HTupleType.DOUBLE, num, out columnComp);
			num = HTuple.LoadNew(proc, 5, HTupleType.DOUBLE, num, out angleComp);
			num = HTuple.LoadNew(proc, 6, HTupleType.DOUBLE, num, out scoreComp);
			num = HTuple.LoadNew(proc, 7, HTupleType.INTEGER, num, out modelComp);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(image);
			return result;
		}

		/// <summary>
		///   Find the best matches of a component model in an image.
		///   Instance represents: Handle of the component model.
		/// </summary>
		/// <param name="image">Input image in which the component model should be found.</param>
		/// <param name="rootComponent">Index of the root component.</param>
		/// <param name="angleStartRoot">Smallest rotation of the root component Default: -0.39</param>
		/// <param name="angleExtentRoot">Extent of the rotation of the root component. Default: 0.79</param>
		/// <param name="minScore">Minimum score of the instances of the component model to be found. Default: 0.5</param>
		/// <param name="numMatches">Number of instances of the component model to be found (or 0 for all matches). Default: 1</param>
		/// <param name="maxOverlap">Maximum overlap of the instances of the component models to be found. Default: 0.5</param>
		/// <param name="ifRootNotFound">Behavior if the root component is missing. Default: "stop_search"</param>
		/// <param name="ifComponentNotFound">Behavior if a component is missing. Default: "prune_branch"</param>
		/// <param name="posePrediction">Pose prediction of components that are not found. Default: "none"</param>
		/// <param name="minScoreComp">Minimum score of the instances of the components to be found. Default: 0.5</param>
		/// <param name="subPixelComp">Subpixel accuracy of the component poses if not equal to 'none'. Default: "least_squares"</param>
		/// <param name="numLevelsComp">Number of pyramid levels for the components used in the matching (and lowest pyramid level to use if $|NumLevelsComp| = 2n$). Default: 0</param>
		/// <param name="greedinessComp">"Greediness" of the search heuristic for the components (0: safe but slow; 1: fast but matches may be missed). Default: 0.9</param>
		/// <param name="modelEnd">End index of each found instance of the component model in the tuples describing the component matches.</param>
		/// <param name="score">Score of the found instances of the component model.</param>
		/// <param name="rowComp">Row coordinate of the found component matches.</param>
		/// <param name="columnComp">Column coordinate of the found component matches.</param>
		/// <param name="angleComp">Rotation angle of the found component matches.</param>
		/// <param name="scoreComp">Score of the found component matches.</param>
		/// <param name="modelComp">Index of the found components.</param>
		/// <returns>Start index of each found instance of the component model in the tuples describing the component matches.</returns>
		// Token: 0x06000380 RID: 896 RVA: 0x00014B10 File Offset: 0x00012D10
		public int FindComponentModel(HImage image, int rootComponent, double angleStartRoot, double angleExtentRoot, double minScore, int numMatches, double maxOverlap, string ifRootNotFound, string ifComponentNotFound, string posePrediction, double minScoreComp, string subPixelComp, int numLevelsComp, double greedinessComp, out int modelEnd, out double score, out double rowComp, out double columnComp, out double angleComp, out double scoreComp, out int modelComp)
		{
			IntPtr proc = HalconAPI.PreCall(995);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, image);
			HalconAPI.StoreI(proc, 1, rootComponent);
			HalconAPI.StoreD(proc, 2, angleStartRoot);
			HalconAPI.StoreD(proc, 3, angleExtentRoot);
			HalconAPI.StoreD(proc, 4, minScore);
			HalconAPI.StoreI(proc, 5, numMatches);
			HalconAPI.StoreD(proc, 6, maxOverlap);
			HalconAPI.StoreS(proc, 7, ifRootNotFound);
			HalconAPI.StoreS(proc, 8, ifComponentNotFound);
			HalconAPI.StoreS(proc, 9, posePrediction);
			HalconAPI.StoreD(proc, 10, minScoreComp);
			HalconAPI.StoreS(proc, 11, subPixelComp);
			HalconAPI.StoreI(proc, 12, numLevelsComp);
			HalconAPI.StoreD(proc, 13, greedinessComp);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			HalconAPI.InitOCT(proc, 4);
			HalconAPI.InitOCT(proc, 5);
			HalconAPI.InitOCT(proc, 6);
			HalconAPI.InitOCT(proc, 7);
			int num = HalconAPI.CallProcedure(proc);
			int result;
			num = HalconAPI.LoadI(proc, 0, num, out result);
			num = HalconAPI.LoadI(proc, 1, num, out modelEnd);
			num = HalconAPI.LoadD(proc, 2, num, out score);
			num = HalconAPI.LoadD(proc, 3, num, out rowComp);
			num = HalconAPI.LoadD(proc, 4, num, out columnComp);
			num = HalconAPI.LoadD(proc, 5, num, out angleComp);
			num = HalconAPI.LoadD(proc, 6, num, out scoreComp);
			num = HalconAPI.LoadI(proc, 7, num, out modelComp);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(image);
			return result;
		}

		/// <summary>
		///   Free the memory of a component model.
		///   Instance represents: Handle of the component model.
		/// </summary>
		// Token: 0x06000381 RID: 897 RVA: 0x00014C64 File Offset: 0x00012E64
		public void ClearComponentModel()
		{
			IntPtr proc = HalconAPI.PreCall(997);
			base.Store(proc, 0);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Return the search tree of a component model.
		///   Instance represents: Handle of the component model.
		/// </summary>
		/// <param name="relations">Relations of components that are connected in the search tree.</param>
		/// <param name="rootComponent">Index of the root component.</param>
		/// <param name="image">Image for which the tree is to be returned. Default: "model_image"</param>
		/// <param name="startNode">Component index of the start node of an arc in the search tree.</param>
		/// <param name="endNode">Component index of the end node of an arc in the search tree.</param>
		/// <param name="row">Row coordinate of the center of the rectangle representing the relation.</param>
		/// <param name="column">Column index of the center of the rectangle representing the relation.</param>
		/// <param name="phi">Orientation of the rectangle representing the relation (radians).</param>
		/// <param name="length1">First radius (half length) of the rectangle representing the relation.</param>
		/// <param name="length2">Second radius (half width) of the rectangle representing the relation.</param>
		/// <param name="angleStart">Smallest relative orientation angle.</param>
		/// <param name="angleExtent">Extent of the relative orientation angle.</param>
		/// <returns>Search tree.</returns>
		// Token: 0x06000382 RID: 898 RVA: 0x00014C98 File Offset: 0x00012E98
		public HRegion GetComponentModelTree(out HRegion relations, HTuple rootComponent, HTuple image, out HTuple startNode, out HTuple endNode, out HTuple row, out HTuple column, out HTuple phi, out HTuple length1, out HTuple length2, out HTuple angleStart, out HTuple angleExtent)
		{
			IntPtr proc = HalconAPI.PreCall(998);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, rootComponent);
			HalconAPI.Store(proc, 2, image);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			HalconAPI.InitOCT(proc, 4);
			HalconAPI.InitOCT(proc, 5);
			HalconAPI.InitOCT(proc, 6);
			HalconAPI.InitOCT(proc, 7);
			HalconAPI.InitOCT(proc, 8);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(rootComponent);
			HalconAPI.UnpinTuple(image);
			HRegion result;
			num = HRegion.LoadNew(proc, 1, num, out result);
			num = HRegion.LoadNew(proc, 2, num, out relations);
			num = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, num, out startNode);
			num = HTuple.LoadNew(proc, 1, HTupleType.INTEGER, num, out endNode);
			num = HTuple.LoadNew(proc, 2, HTupleType.DOUBLE, num, out row);
			num = HTuple.LoadNew(proc, 3, HTupleType.DOUBLE, num, out column);
			num = HTuple.LoadNew(proc, 4, HTupleType.DOUBLE, num, out phi);
			num = HTuple.LoadNew(proc, 5, HTupleType.DOUBLE, num, out length1);
			num = HTuple.LoadNew(proc, 6, HTupleType.DOUBLE, num, out length2);
			num = HTuple.LoadNew(proc, 7, HTupleType.DOUBLE, num, out angleStart);
			num = HTuple.LoadNew(proc, 8, HTupleType.DOUBLE, num, out angleExtent);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Return the search tree of a component model.
		///   Instance represents: Handle of the component model.
		/// </summary>
		/// <param name="relations">Relations of components that are connected in the search tree.</param>
		/// <param name="rootComponent">Index of the root component.</param>
		/// <param name="image">Image for which the tree is to be returned. Default: "model_image"</param>
		/// <param name="startNode">Component index of the start node of an arc in the search tree.</param>
		/// <param name="endNode">Component index of the end node of an arc in the search tree.</param>
		/// <param name="row">Row coordinate of the center of the rectangle representing the relation.</param>
		/// <param name="column">Column index of the center of the rectangle representing the relation.</param>
		/// <param name="phi">Orientation of the rectangle representing the relation (radians).</param>
		/// <param name="length1">First radius (half length) of the rectangle representing the relation.</param>
		/// <param name="length2">Second radius (half width) of the rectangle representing the relation.</param>
		/// <param name="angleStart">Smallest relative orientation angle.</param>
		/// <param name="angleExtent">Extent of the relative orientation angle.</param>
		/// <returns>Search tree.</returns>
		// Token: 0x06000383 RID: 899 RVA: 0x00014DC4 File Offset: 0x00012FC4
		public HRegion GetComponentModelTree(out HRegion relations, int rootComponent, string image, out int startNode, out int endNode, out double row, out double column, out double phi, out double length1, out double length2, out double angleStart, out double angleExtent)
		{
			IntPtr proc = HalconAPI.PreCall(998);
			base.Store(proc, 0);
			HalconAPI.StoreI(proc, 1, rootComponent);
			HalconAPI.StoreS(proc, 2, image);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			HalconAPI.InitOCT(proc, 4);
			HalconAPI.InitOCT(proc, 5);
			HalconAPI.InitOCT(proc, 6);
			HalconAPI.InitOCT(proc, 7);
			HalconAPI.InitOCT(proc, 8);
			int num = HalconAPI.CallProcedure(proc);
			HRegion result;
			num = HRegion.LoadNew(proc, 1, num, out result);
			num = HRegion.LoadNew(proc, 2, num, out relations);
			num = HalconAPI.LoadI(proc, 0, num, out startNode);
			num = HalconAPI.LoadI(proc, 1, num, out endNode);
			num = HalconAPI.LoadD(proc, 2, num, out row);
			num = HalconAPI.LoadD(proc, 3, num, out column);
			num = HalconAPI.LoadD(proc, 4, num, out phi);
			num = HalconAPI.LoadD(proc, 5, num, out length1);
			num = HalconAPI.LoadD(proc, 6, num, out length2);
			num = HalconAPI.LoadD(proc, 7, num, out angleStart);
			num = HalconAPI.LoadD(proc, 8, num, out angleExtent);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Return the parameters of a component model.
		///   Instance represents: Handle of the component model.
		/// </summary>
		/// <param name="rootRanking">Ranking of the model components expressing their suitability to act as root component.</param>
		/// <param name="shapeModelIDs">Handles of the shape models of the individual model components.</param>
		/// <returns>Minimum score of the instances of the components to be found.</returns>
		// Token: 0x06000384 RID: 900 RVA: 0x00014EDC File Offset: 0x000130DC
		public HTuple GetComponentModelParams(out HTuple rootRanking, out HShapeModel[] shapeModelIDs)
		{
			IntPtr proc = HalconAPI.PreCall(999);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, num, out result);
			num = HTuple.LoadNew(proc, 1, HTupleType.INTEGER, num, out rootRanking);
			num = HShapeModel.LoadNew(proc, 2, num, out shapeModelIDs);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Return the parameters of a component model.
		///   Instance represents: Handle of the component model.
		/// </summary>
		/// <param name="rootRanking">Ranking of the model components expressing their suitability to act as root component.</param>
		/// <param name="shapeModelIDs">Handles of the shape models of the individual model components.</param>
		/// <returns>Minimum score of the instances of the components to be found.</returns>
		// Token: 0x06000385 RID: 901 RVA: 0x00014F4C File Offset: 0x0001314C
		public double GetComponentModelParams(out int rootRanking, out HShapeModel shapeModelIDs)
		{
			IntPtr proc = HalconAPI.PreCall(999);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			double result;
			num = HalconAPI.LoadD(proc, 0, num, out result);
			num = HalconAPI.LoadI(proc, 1, num, out rootRanking);
			num = HShapeModel.LoadNew(proc, 2, num, out shapeModelIDs);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Deserialize a serialized component model.
		///   Modified instance represents: Handle of the component model.
		/// </summary>
		/// <param name="serializedItemHandle">Handle of the serialized item.</param>
		// Token: 0x06000386 RID: 902 RVA: 0x00014FB8 File Offset: 0x000131B8
		public void DeserializeComponentModel(HSerializedItem serializedItemHandle)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1000);
			HalconAPI.Store(proc, 0, serializedItemHandle);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(serializedItemHandle);
		}

		/// <summary>
		///   Serialize a component model.
		///   Instance represents: Handle of the component model.
		/// </summary>
		/// <returns>Handle of the serialized item.</returns>
		// Token: 0x06000387 RID: 903 RVA: 0x0001500C File Offset: 0x0001320C
		public HSerializedItem SerializeComponentModel()
		{
			IntPtr proc = HalconAPI.PreCall(1001);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HSerializedItem result;
			num = HSerializedItem.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Read a component model from a file.
		///   Modified instance represents: Handle of the component model.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x06000388 RID: 904 RVA: 0x00015054 File Offset: 0x00013254
		public void ReadComponentModel(string fileName)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1002);
			HalconAPI.StoreS(proc, 0, fileName);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Write a component model to a file.
		///   Instance represents: Handle of the component model.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x06000389 RID: 905 RVA: 0x000150A0 File Offset: 0x000132A0
		public void WriteComponentModel(string fileName)
		{
			IntPtr proc = HalconAPI.PreCall(1003);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, fileName);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Prepare a component model for matching based on explicitly specified components and relations.
		///   Modified instance represents: Handle of the component model.
		/// </summary>
		/// <param name="modelImage">Input image from which the shape models of the model components should be created.</param>
		/// <param name="componentRegions">Input regions from which the shape models of the model components should be created.</param>
		/// <param name="variationRow">Variation of the model components in row direction.</param>
		/// <param name="variationColumn">Variation of the model components in column direction.</param>
		/// <param name="variationAngle">Angle variation of the model components.</param>
		/// <param name="angleStart">Smallest rotation of the component model. Default: -0.39</param>
		/// <param name="angleExtent">Extent of the rotation of the component model. Default: 0.79</param>
		/// <param name="contrastLowComp">Lower hysteresis threshold for the contrast of the components in the model image. Default: "auto"</param>
		/// <param name="contrastHighComp">Upper hysteresis threshold for the contrast of the components in the model image. Default: "auto"</param>
		/// <param name="minSizeComp">Minimum size of the contour regions in the model. Default: "auto"</param>
		/// <param name="minContrastComp">Minimum contrast of the components in the search images. Default: "auto"</param>
		/// <param name="minScoreComp">Minimum score of the instances of the components to be found. Default: 0.5</param>
		/// <param name="numLevelsComp">Maximum number of pyramid levels for the components. Default: "auto"</param>
		/// <param name="angleStepComp">Step length of the angles (resolution) for the components. Default: "auto"</param>
		/// <param name="optimizationComp">Kind of optimization for the components. Default: "auto"</param>
		/// <param name="metricComp">Match metric used for the components. Default: "use_polarity"</param>
		/// <param name="pregenerationComp">Complete pregeneration of the shape models for the components if equal to 'true'. Default: "false"</param>
		/// <returns>Ranking of the model components expressing the suitability to act as the root component.</returns>
		// Token: 0x0600038A RID: 906 RVA: 0x000150DC File Offset: 0x000132DC
		public HTuple CreateComponentModel(HImage modelImage, HRegion componentRegions, HTuple variationRow, HTuple variationColumn, HTuple variationAngle, double angleStart, double angleExtent, HTuple contrastLowComp, HTuple contrastHighComp, HTuple minSizeComp, HTuple minContrastComp, HTuple minScoreComp, HTuple numLevelsComp, HTuple angleStepComp, string optimizationComp, HTuple metricComp, HTuple pregenerationComp)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1004);
			HalconAPI.Store(proc, 1, modelImage);
			HalconAPI.Store(proc, 2, componentRegions);
			HalconAPI.Store(proc, 0, variationRow);
			HalconAPI.Store(proc, 1, variationColumn);
			HalconAPI.Store(proc, 2, variationAngle);
			HalconAPI.StoreD(proc, 3, angleStart);
			HalconAPI.StoreD(proc, 4, angleExtent);
			HalconAPI.Store(proc, 5, contrastLowComp);
			HalconAPI.Store(proc, 6, contrastHighComp);
			HalconAPI.Store(proc, 7, minSizeComp);
			HalconAPI.Store(proc, 8, minContrastComp);
			HalconAPI.Store(proc, 9, minScoreComp);
			HalconAPI.Store(proc, 10, numLevelsComp);
			HalconAPI.Store(proc, 11, angleStepComp);
			HalconAPI.StoreS(proc, 12, optimizationComp);
			HalconAPI.Store(proc, 13, metricComp);
			HalconAPI.Store(proc, 14, pregenerationComp);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(variationRow);
			HalconAPI.UnpinTuple(variationColumn);
			HalconAPI.UnpinTuple(variationAngle);
			HalconAPI.UnpinTuple(contrastLowComp);
			HalconAPI.UnpinTuple(contrastHighComp);
			HalconAPI.UnpinTuple(minSizeComp);
			HalconAPI.UnpinTuple(minContrastComp);
			HalconAPI.UnpinTuple(minScoreComp);
			HalconAPI.UnpinTuple(numLevelsComp);
			HalconAPI.UnpinTuple(angleStepComp);
			HalconAPI.UnpinTuple(metricComp);
			HalconAPI.UnpinTuple(pregenerationComp);
			num = base.Load(proc, 0, num);
			HTuple result;
			num = HTuple.LoadNew(proc, 1, HTupleType.INTEGER, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(modelImage);
			GC.KeepAlive(componentRegions);
			return result;
		}

		/// <summary>
		///   Prepare a component model for matching based on explicitly specified components and relations.
		///   Modified instance represents: Handle of the component model.
		/// </summary>
		/// <param name="modelImage">Input image from which the shape models of the model components should be created.</param>
		/// <param name="componentRegions">Input regions from which the shape models of the model components should be created.</param>
		/// <param name="variationRow">Variation of the model components in row direction.</param>
		/// <param name="variationColumn">Variation of the model components in column direction.</param>
		/// <param name="variationAngle">Angle variation of the model components.</param>
		/// <param name="angleStart">Smallest rotation of the component model. Default: -0.39</param>
		/// <param name="angleExtent">Extent of the rotation of the component model. Default: 0.79</param>
		/// <param name="contrastLowComp">Lower hysteresis threshold for the contrast of the components in the model image. Default: "auto"</param>
		/// <param name="contrastHighComp">Upper hysteresis threshold for the contrast of the components in the model image. Default: "auto"</param>
		/// <param name="minSizeComp">Minimum size of the contour regions in the model. Default: "auto"</param>
		/// <param name="minContrastComp">Minimum contrast of the components in the search images. Default: "auto"</param>
		/// <param name="minScoreComp">Minimum score of the instances of the components to be found. Default: 0.5</param>
		/// <param name="numLevelsComp">Maximum number of pyramid levels for the components. Default: "auto"</param>
		/// <param name="angleStepComp">Step length of the angles (resolution) for the components. Default: "auto"</param>
		/// <param name="optimizationComp">Kind of optimization for the components. Default: "auto"</param>
		/// <param name="metricComp">Match metric used for the components. Default: "use_polarity"</param>
		/// <param name="pregenerationComp">Complete pregeneration of the shape models for the components if equal to 'true'. Default: "false"</param>
		/// <returns>Ranking of the model components expressing the suitability to act as the root component.</returns>
		// Token: 0x0600038B RID: 907 RVA: 0x00015230 File Offset: 0x00013430
		public int CreateComponentModel(HImage modelImage, HRegion componentRegions, int variationRow, int variationColumn, double variationAngle, double angleStart, double angleExtent, int contrastLowComp, int contrastHighComp, int minSizeComp, int minContrastComp, double minScoreComp, int numLevelsComp, double angleStepComp, string optimizationComp, string metricComp, string pregenerationComp)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1004);
			HalconAPI.Store(proc, 1, modelImage);
			HalconAPI.Store(proc, 2, componentRegions);
			HalconAPI.StoreI(proc, 0, variationRow);
			HalconAPI.StoreI(proc, 1, variationColumn);
			HalconAPI.StoreD(proc, 2, variationAngle);
			HalconAPI.StoreD(proc, 3, angleStart);
			HalconAPI.StoreD(proc, 4, angleExtent);
			HalconAPI.StoreI(proc, 5, contrastLowComp);
			HalconAPI.StoreI(proc, 6, contrastHighComp);
			HalconAPI.StoreI(proc, 7, minSizeComp);
			HalconAPI.StoreI(proc, 8, minContrastComp);
			HalconAPI.StoreD(proc, 9, minScoreComp);
			HalconAPI.StoreI(proc, 10, numLevelsComp);
			HalconAPI.StoreD(proc, 11, angleStepComp);
			HalconAPI.StoreS(proc, 12, optimizationComp);
			HalconAPI.StoreS(proc, 13, metricComp);
			HalconAPI.StoreS(proc, 14, pregenerationComp);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			int result;
			num = HalconAPI.LoadI(proc, 1, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(modelImage);
			GC.KeepAlive(componentRegions);
			return result;
		}

		/// <summary>
		///   Prepare a component model for matching based on trained components.
		///   Modified instance represents: Handle of the component model.
		/// </summary>
		/// <param name="componentTrainingID">Handle of the training result.</param>
		/// <param name="angleStart">Smallest rotation of the component model. Default: -0.39</param>
		/// <param name="angleExtent">Extent of the rotation of the component model. Default: 0.79</param>
		/// <param name="minContrastComp">Minimum contrast of the components in the search images. Default: "auto"</param>
		/// <param name="minScoreComp">Minimum score of the instances of the components to be found. Default: 0.5</param>
		/// <param name="numLevelsComp">Maximum number of pyramid levels for the components. Default: "auto"</param>
		/// <param name="angleStepComp">Step length of the angles (resolution) for the components. Default: "auto"</param>
		/// <param name="optimizationComp">Kind of optimization for the components. Default: "auto"</param>
		/// <param name="metricComp">Match metric used for the components. Default: "use_polarity"</param>
		/// <param name="pregenerationComp">Complete pregeneration of the shape models for the components if equal to 'true'. Default: "false"</param>
		/// <returns>Ranking of the model components expressing the suitability to act as the root component.</returns>
		// Token: 0x0600038C RID: 908 RVA: 0x00015330 File Offset: 0x00013530
		public HTuple CreateTrainedComponentModel(HComponentTraining componentTrainingID, double angleStart, double angleExtent, HTuple minContrastComp, HTuple minScoreComp, HTuple numLevelsComp, HTuple angleStepComp, string optimizationComp, HTuple metricComp, HTuple pregenerationComp)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1005);
			HalconAPI.Store(proc, 0, componentTrainingID);
			HalconAPI.StoreD(proc, 1, angleStart);
			HalconAPI.StoreD(proc, 2, angleExtent);
			HalconAPI.Store(proc, 3, minContrastComp);
			HalconAPI.Store(proc, 4, minScoreComp);
			HalconAPI.Store(proc, 5, numLevelsComp);
			HalconAPI.Store(proc, 6, angleStepComp);
			HalconAPI.StoreS(proc, 7, optimizationComp);
			HalconAPI.Store(proc, 8, metricComp);
			HalconAPI.Store(proc, 9, pregenerationComp);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(minContrastComp);
			HalconAPI.UnpinTuple(minScoreComp);
			HalconAPI.UnpinTuple(numLevelsComp);
			HalconAPI.UnpinTuple(angleStepComp);
			HalconAPI.UnpinTuple(metricComp);
			HalconAPI.UnpinTuple(pregenerationComp);
			num = base.Load(proc, 0, num);
			HTuple result;
			num = HTuple.LoadNew(proc, 1, HTupleType.INTEGER, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(componentTrainingID);
			return result;
		}

		/// <summary>
		///   Prepare a component model for matching based on trained components.
		///   Modified instance represents: Handle of the component model.
		/// </summary>
		/// <param name="componentTrainingID">Handle of the training result.</param>
		/// <param name="angleStart">Smallest rotation of the component model. Default: -0.39</param>
		/// <param name="angleExtent">Extent of the rotation of the component model. Default: 0.79</param>
		/// <param name="minContrastComp">Minimum contrast of the components in the search images. Default: "auto"</param>
		/// <param name="minScoreComp">Minimum score of the instances of the components to be found. Default: 0.5</param>
		/// <param name="numLevelsComp">Maximum number of pyramid levels for the components. Default: "auto"</param>
		/// <param name="angleStepComp">Step length of the angles (resolution) for the components. Default: "auto"</param>
		/// <param name="optimizationComp">Kind of optimization for the components. Default: "auto"</param>
		/// <param name="metricComp">Match metric used for the components. Default: "use_polarity"</param>
		/// <param name="pregenerationComp">Complete pregeneration of the shape models for the components if equal to 'true'. Default: "false"</param>
		/// <returns>Ranking of the model components expressing the suitability to act as the root component.</returns>
		// Token: 0x0600038D RID: 909 RVA: 0x00015414 File Offset: 0x00013614
		public int CreateTrainedComponentModel(HComponentTraining componentTrainingID, double angleStart, double angleExtent, int minContrastComp, double minScoreComp, int numLevelsComp, double angleStepComp, string optimizationComp, string metricComp, string pregenerationComp)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1005);
			HalconAPI.Store(proc, 0, componentTrainingID);
			HalconAPI.StoreD(proc, 1, angleStart);
			HalconAPI.StoreD(proc, 2, angleExtent);
			HalconAPI.StoreI(proc, 3, minContrastComp);
			HalconAPI.StoreD(proc, 4, minScoreComp);
			HalconAPI.StoreI(proc, 5, numLevelsComp);
			HalconAPI.StoreD(proc, 6, angleStepComp);
			HalconAPI.StoreS(proc, 7, optimizationComp);
			HalconAPI.StoreS(proc, 8, metricComp);
			HalconAPI.StoreS(proc, 9, pregenerationComp);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			int result;
			num = HalconAPI.LoadI(proc, 1, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(componentTrainingID);
			return result;
		}
	}
}
